//
//  AllDefines.h
//  fuyoukache
//
//  Created by enway-wk on 15/5/31.
//  Copyright (c) 2015年 enway-wk. All rights reserved.
//

#ifndef fuyoukache_AllDefines_h
#define fuyoukache_AllDefines_h


#ifdef DEBUG
#define debugLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"[method] = >%s", __func__)
#else
#define debugLog(...)
#define debugMethod()
#endif

#ifdef  DEBUG
#define NSLog(format, ...) NSLog(format, ## __VA_ARGS__)
#else
#define NSLog(format, ...){}
#endif

// 屏幕尺寸适配
#define IS_IPAD     [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad
#define IS_IPHONE   [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone
#define IS_IPHONE_4s (fabs((double)[[UIScreen mainScreen] bounds].size.height - (double )480) < DBL_EPSILON )
#define IS_IPHONE_5s (fabs((double)[[UIScreen mainScreen] bounds].size.height - (double )568) < DBL_EPSILON )
#define IS_IPHONE_6s (fabs((double)[[UIScreen mainScreen] bounds].size.height - (double )667) < DBL_EPSILON )
#define IS_IPHONE_6_PLUS (fabs((double)[[UIScreen mainScreen] bounds].size.height - (double )736) < DBL_EPSILON )
#define kDevice_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

#define NavHeight kDevice_Is_iPhoneX ? 88:64

#define kLimit 10



#define ImageButtonWidth ([UIScreen mainScreen].bounds.size.width - 96) / 7
#define Color(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]

#define ScreenWidth [UIScreen mainScreen].bounds.size.width
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
#define kSpace 10
#define imgWidth ([UIScreen mainScreen].bounds.size.width-20 *4)/3//高宽相等
//判断字符串为空
#define NULLString(string) ((![string isKindOfClass:[NSString class]])||[string isEqualToString:@""] || (string == nil) || [string isEqualToString:@""] || [string isKindOfClass:[NSNull class]]||[[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0)

//判断int为0
#define ZERO(value)((0 == value))

//系统版本
#define IOS_VERSION         [[[UIDevice currentDevice] systemVersion] floatValue]
#define STATUSBAR_HEIGHT    ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0?20.0:0.0)
#define KIsiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
//statusbar ＋ topbar height
#define TOPBAR_STATUSBAR_HEIGHT (44+STATUSBAR_HEIGHT)
#define PADDING_TOP_SIZE 10
#define PADDING_LEFT_SIZE 15
#define PADDING_RIGHT_SIZE 20
#define FIRST_CELL_PADDING_TOP_SIZE 18

//APP版本
#define APP_VERSION         [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
#define APP_BUILD_VERSION   [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]

//全局常量
#define kScreenWidth         [[UIScreen mainScreen] bounds].size.width
#define kScreenHeight        [[UIScreen mainScreen] bounds].size.height
#define APPDELEGATE         (AppDelegate *)[[UIApplication sharedApplication] delegate]
//屏幕适配
#define DISTENCEW  (kScreenWidth/320)
#define DISTENCEH  (kScreenHeight/568)

//文字与cell左侧距离（只有文字没有图标类型的）
#define kPaddingText          (20/2)
//判断手机类型

#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) : NO)

#define iPhone6plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size)) : NO)

//常用颜色值
#define COMMONVIEWBG                @"f1f1f1"
#define kToolBarBg                  @"f8f8f8" //选择器工具栏背景色
#define kNomalBtnColor              @"91c150"
#define tishiViewBgColor            @"693082"
#define HINT_COLOR                  @"d0d0d0"
#define HINT_COLOR2                 @"9a9a9a"
#define WARNINGCOLOR                @"e4002b"
#define DefaultInfoColor            @"c5c5c5"
#define BTNJINYONGCOLOR             @"78cde8"
#define WRITETEXTCOLOR              @"101010"
#define MYGRAYCOLOR                 @"9ba5a8"
#define kColorCellTitle             [UIColor blackColor]
#define kColorButtonEnableYellow          ([UIColor hexStringToColor:@"#F0601E" alpha:1.0f])
#define kColorButtonEnable          ([UIColor hexStringToColor:@"#3D84FB" alpha:1.0f])
#define kColorButtonDisabled        ([UIColor hexStringToColor:@"#3D84FB" alpha:0.5f])

/**
 *  分割线
 */
#define kColore2e2e2   ([UIColor hexStringToColor:@"#e2e2e2" alpha:1.0f])

/**
 *  用到的黑色的字体颜色
 */
#define kColor101010   ([UIColor hexStringToColor:@"#101010" alpha:1.0f])
#define kColorf1f1f1   ([UIColor hexStringToColor:@"#f1f1f1" alpha:1.0f])

#define kColor8e8e8e   ([UIColor hexStringToColor:@"#8e8e8e" alpha:1.0f])
#define kColorc5c5c5   ([UIColor hexStringToColor:@"#c5c5c5" alpha:1.0f])
#define kColore2e2e2   ([UIColor hexStringToColor:@"#e2e2e2" alpha:1.0f])

/**
 *  Color
 */

/**
 *导航条颜色（蓝色）
 **/
#define kNavigationTintColor   ([UIColor hexStringToColor:@"#3385ff" alpha:1.0f])
#define kColor00a9e0   ([UIColor hexStringToColor:@"#00a9e0" alpha:1.0f])
/**
 *导航条文字颜色（白色）
 **/
#define kNavigationTitleColor   ([UIColor hexStringToColor:@"#ffffff" alpha:1.0f])
/**
 *  用到的黑色的字体颜色
 */
#define kColor101010   ([UIColor hexStringToColor:@"#101010" alpha:1.0f])
#define kColor111111   ([UIColor hexStringToColor:@"#111111" alpha:1.0f])
#define kColor333333   ([UIColor hexStringToColor:@"#333333" alpha:1.0f])
/**
 *  常用的绿色
 */
#define kColor2ecc71   ([UIColor hexStringToColor:@"#00a9e0" alpha:1.0f])
/**
 *  背景颜色
 */
#define kColorf1f1f1   ([UIColor hexStringToColor:@"#f1f1f1" alpha:1.0f])
#define kColorf2f6f7   ([UIColor hexStringToColor:@"#f2f6f7" alpha:1.0f])

/**
 *  常用的橘红色
 */
#define kColorff6900   ([UIColor hexStringToColor:@"#ff6900" alpha:1.0f])
#define kColorfe6900   ([UIColor hexStringToColor:@"#fe6900" alpha:1.0f])
#define kColorfff7f2   ([UIColor hexStringToColor:@"#fff7f2" alpha:1.0f])
#define kColorff7870  ([UIColor hexStringToColor:@"#ff7870" alpha:1.0f])
/**
 *  常用的红色
 */
#define kColore4002b   ([UIColor hexStringToColor:@"#e40026" alpha:1.0f])
/**
 *  常用的灰色(tabbar的灰色)
 */
#define kColor8e8e8e   ([UIColor hexStringToColor:@"#8e8e8e" alpha:1.0f])
#define kColor666666   ([UIColor hexStringToColor:@"#666666" alpha:1.0f])
#define kColor999999   ([UIColor hexStringToColor:@"#999999" alpha:1.0f])
#define kColord8d8d8   ([UIColor hexStringToColor:@"#d8d8d8" alpha:1.0f])
/**
 *  常用的浅灰色
 */
#define kColorc5c5c5   ([UIColor hexStringToColor:@"#c5c5c5" alpha:1.0f])

#define kColora3a3a3   ([UIColor hexStringToColor:@"#a3a3a3" alpha:1.0f])
/**
 *  常用的分割线颜色
 */
#define kColore2e2e2   ([UIColor hexStringToColor:@"#e2e2e2" alpha:1.0f])


/**
 *  金色字体
 */
#define kColorfffc00   ([UIColor hexStringToColor:@"#fffc00" alpha:1.0f])


/**
 *  浮层背景色
 */
#define kColorf6f6f6   ([UIColor hexStringToColor:@"#f6f6f6" alpha:1.0f])

#define backgroundcolor [UIColor colorWithRed:242 / 255.0 green:242 / 255.0 blue:242 / 255.0 alpha:1]

/**
 *  常用的红色
 */
#define kColorff0000   ([UIColor hexStringToColor:@"#ff0000" alpha:1.0f])

#define KItemColor [UIColor hexStringToColor:@"#676767" alpha:1.0]
#define KTitleColor [UIColor hexStringToColor:@"#000000" alpha:1.0]
#define KNormolColor [UIColor hexStringToColor:@"#3da8f5" alpha:1.0]
#define KNormalGrayColor [UIColor hexStringToColor:@"#aeaeae" alpha:1.0]


/*
 *系统颜色简写
 */
#define kClearColor      ([UIColor clearColor])
#define kWhiteColor      ([UIColor whiteColor])
#define kLightGrayColor  ([UIColor lightGrayColor])
#define kRedColor        ([UIColor redColor])
#define kGreenColor      ([UIColor greenColor])
#define kBlackColor      ([UIColor blackColor])
#define kGrayColor       ([UIColor grayColor])

#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
/**
 *按钮弧度
 **/
#define  kCornerRadius                 2

//文件系统目录
#define PATH_OF_APP_HOME    NSHomeDirectory()
#define PATH_OF_TEMP        NSTemporaryDirectory()
#define PATH_OF_DOCUMENT    [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]

//命名常量
#define KUID                @"KUID"
//#define KUKEY               @"KUKEY"
#define KUSERDETAILINFO     @"KUSERDETAILINFO"
#define kGexinClientID      @"kGexinClientID"
#define KUSERCONTRACT       @"kUserContract"
#define KREORDERDATA        @"kReOrderData"

#define LINEHEIGHT 2.0
#define SEND_PRODUCT_TEXTSIZE 14
#define SEND_PRODUCT_PADDINGLEFT 110

// 强弱引用

#define WEAKSELF __weak __typeof(self) weakSelf = self;

#define STRONGSELF __strong __typeof(self) strongSelf = weakSelf;

//字体
#define kFontSystem(size)         ([UIFont systemFontOfSize:size])
#define kFontSystemBIgger1(size)   (ScreenWidth > 320 ? [UIFont systemFontOfSize:(size+1)] : [UIFont systemFontOfSize:size])
#define kFontSystemBIgger2(size)   (ScreenWidth > 320 ? [UIFont systemFontOfSize:(size+2)] : [UIFont systemFontOfSize:size])

#define kFontBoldSystem(size)     ([UIFont boldSystemFontOfSize:size])


#define kCellLeftPadding  15

//分页条数
#define kPagesize     10
//指示器
#define HUDNormal(msg) {MBProgressHUD *hud=[MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication].delegate window] animated:NO];\
hud.mode = MBProgressHUDModeText;\
hud.minShowTime=2;\
hud.detailsLabelText= msg;\
hud.detailsLabelFont = [UIFont systemFontOfSize:15];\
[hud hide:YES afterDelay:1];\
}

//系统代号（2=android,3=ios）
#define kClient                 @"3"
//对应build号
#define app_build             [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
//手机型号
#define kDeviceModel          [[UIDevice currentDevice] model]
//系统名字“iphone os”
#define kDeviceSystemName     [[[UIDevice currentDevice] systemName] lowercaseString]
//对应bundleId
#define app_bundleId           [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]



#define kIconFont(s)              ([UIFont fontWithName:@"iconfont" size:(s)])

#define loadNib(nibName)          ([[NSBundle mainBundle] loadNibNamed:(nibName) owner:nil options:nil].firstObject)

#define kAppScheme  @"fuyoukachehuozhu"

/**
 *  用于版本更新的AppStore地址
 */
#define kFYKC_APP_URL                   @"itms-apps://itunes.apple.com/app/id1011695242"


//屏幕适配(iPhone4)?(.39):
#define  KDISTENCEW            (0.5)// MAX((0.5),(kScreenWidth/750.0))
#define  KDISTENCEH            (KDISTENCEW) //MAX((0.5),(kScreenHeightFull/1334.0))

#define SYRealValue(value) ((value) / 375.0f * kScreenWidth)
/*客服电话*/
#define  kForyouPhone                         @"4008-520-222"

/*homepage新手引导页展示*/
#define  KFIRSTLOGIN        @"KFIRSTLOGIN"
/*app引导页展示*/
#define  KHAVELUNCHED       @"KHAVELUNCHED_2.3"

//AES 密钥
#define   kAESKEY             @"1IhB3rhDU5K9225j"
#define kCookie         @"cookieId"
#define kLoginMsg      @"loginMsg"
/*homepage新手引导页展示*/
#define  KFIRSTLOGIN        @"KFIRSTLOGIN"
#define  KISNEW              @"ISNEW"
#define  kFIRSTADVERT      @"FIRSTADVERT"
//线宽
#define kLineHeight (1 / [UIScreen mainScreen].scale)
#define  DUP kScreenWidth/414
#define SCREEN_BOUNDS   [UIScreen mainScreen].bounds


/**
 *nav
 */
#define NAVBAR_COLORCHANGE_POINT (-IMAGE_HEIGHT + NAV_HEIGHT)
#define NAV_HEIGHT 64
#define IMAGE_HEIGHT 200
#define SCROLL_DOWN_LIMIT 70
#define LIMIT_OFFSET_Y -(IMAGE_HEIGHT + SCROLL_DOWN_LIMIT)




#endif
